import request from "@/utils/request";

//获取主页面表格数据
export function getDishes(params) {
  return request({
    url: "/dish/page",
    method: "get",
    params,
  });
}

//删除
export function batchDeleteDishes(id) {
  return request({
    url: `/dish?ids=${id}`,
    method: "delete",
    // id,
  });
}

//启售
export function startDishStatus(data) {
  return request({
    url: `/dish/status/1?ids=${data}`,
    method: "post",
  });
}

//停售
export function stopDishStatus(data) {
  return request({
    url: `/dish/status/0?ids=${data}`,
    method: "post",
  });
}

//获取下拉框选项
export function getList(params) {
  return request({
    url: `/category/list?type=${params}`,
    method: "get",
  });
}
//获取表单（修改进入时）
export function getForm(params) {
  return request({
    url: `/dish/${params}`,
    method: "get",
  });
}

//新增菜品
export function addDishes(data) {
  return request({
    url: `/dish`,
    method: "post",
    data,
  });
}

//修改菜品
export function changeDishes(data) {
  return request({
    url: `/dish`,
    method: "put",
    data,
  });
}
